//
//  TicketPersonEntity.m
//  SXH
//
//  Created by Jack on 15/12/10.
//  Copyright © 2015年 lyss. All rights reserved.
//

#import "TicketPersonEntity.h"

@implementation TicketPersonEntity

@synthesize name,phone,uniqueID,ID;

- (instancetype)initWithAttributes:(NSDictionary *)attributes {
    
    self = [super init];
    if (!self) {
        return nil;
    }
    
    self.name= [attributes valueForKeyPath:@"nickname"];
    self.phone = [attributes valueForKeyPath:@"phone"];
    self.uniqueID = [attributes valueForKeyPath:@"idno"];
    self.ID = [attributes valueForKeyPath:@"id"];
    
    return self;
}

/**
 *  将对象写入文件的时候调用
 *  怎样存储
 *
 *  @param aCoder aCoder
 */
- (void)encodeWithCoder:(NSCoder *)encoder{
    [encoder encodeObject:self.name forKey:@"nickname"];
    [encoder encodeObject:self.phone forKey:@"phone"];
    [encoder encodeObject:self.uniqueID forKey:@"idno"];
    [encoder encodeObject:self.ID forKey:@"id"];
}

- (id)initWithCoder:(NSCoder *)decoder{
    if(self = [super init]) {
        self.name = [decoder decodeObjectForKey:@"nickname"];
        self.phone = [decoder decodeObjectForKey:@"phone"];
        self.uniqueID = [decoder decodeObjectForKey:@"idno"];
        self.ID = [decoder decodeObjectForKey:@"id"];
    }
    
    return self;
}

@end
